﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SearchData
{
    public partial class frmShowDetails : Form
    {
     
        public frmShowDetails()
        {
            InitializeComponent();           
           
        }
        public void FillGrid(DataSet ds)
        {
            grdDetails.DataSource = ds.Tables[0];
            SetGridSize();
        }

        private void frmShowDetails_Resize(object sender, EventArgs e)
        {
            SetGridSize();
        }

        private void SetGridSize()
        {
            grdDetails.Width = this.Width;
            grdDetails.Height = this.Height;
            int colCounts = grdDetails.Columns.Count;
            for (int i = 0; i < colCounts; i++)
            {
                grdDetails.Columns[i].Width = (this.Width-55) / colCounts;
            }
        }

        private void frmShowDetails_ClientSizeChanged(object sender, EventArgs e)
        {
            SetGridSize();
        }
    }
}
